package com.showsu.editor.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.showsu.editor.entity.doo.RemoteInterfaceSwitchRecord;
import com.showsu.editor.entity.po.TblRemoteInterfaceSwitchRecord;

import java.util.Date;
import java.util.List;

/**
 * @Author: William
 * @Description:
 * @Date: Created in 3:16 下午 2024/3/8
 * @Modified By:
 */
public interface IRemoteInterfaceSwitchRecordService extends IService<TblRemoteInterfaceSwitchRecord> {

    /**
     * 查询某个接口类型最近一条切换记录
     * @param interfaceName
     * @return
     */
    RemoteInterfaceSwitchRecord queryLastSwitchRecordByInterfaceName(String interfaceName);

    /**
     * 新增记录
     * @param interfaceName
     * @param interfaceId
     * @param params 记录参数信息，传递格式：key=value,key=value,.....
     */
    int add(String interfaceName, Long interfaceId, String params);

    /**
     * 查询以接口id的切换记录，且是最近一条记录
     * @param interfaceId
     * @return
     */
    RemoteInterfaceSwitchRecord queryLastSwitchRecordByInterfaceId(Long interfaceId);

    /**
     * 查询最近某个时间起，最后一条接口切换记录。按接口id分组。
     * @param time
     * @return
     */
    List<RemoteInterfaceSwitchRecord> queryLastSwitchRecordInRecentTimesGroupByInterfaceId(Date time);
}
